//点击头部跳转首页
$(".headerUl li").each(function(i,n){
    $(n).click(function(){
        window.location.href="../index.html"
    })
})
$("#login").click(function(){
    window.location.href="../html/login.html"
})
$("#join").click(function(){
    window.location.href="../html/join.html"
})
$("#loginBtn").click(function(){
    var usertel=$("#usertel").val();
    console.log(usertel);
    var userpwd=$("#userpwd").val();
    console.log(userpwd);
    $.ajax({
        type: "get",
        url: "../php/login.php",
        data: {"usertel":usertel,"userpwd":userpwd},
        dataType: "json",
        success: function (obj) {
           
            if(obj["code"]==1){
                console.log(usertel);
                setCookie("logintel",usertel,7);
                setCookie("loginpwd",userpwd,7);
                if(getCookie("backUrl")){
                    window.location.href=getCookie('backUrl');
                }else{
                    window.location.href="../index.html";
                }
               
            }else{
                alert(obj.msg);
            }
        }
    });
})